package cn.edu.seu.ssny.service;


import cn.edu.seu.ssny.entity.*;
import cn.edu.seu.ssny.service.support.IBaseService;

import java.util.List;
import java.util.Optional;

public interface IDeviceService extends IBaseService<Device, Integer> {

    Device findByName(String name);

    List<Device> findByProject(Project project);

    Optional<Device> findByNameAndProject(String name, Project project);

    List<Device> findByEnterprise(Enterprise enterprise);

    Device findByProjectAndGatewayAndTag(Project project, Gateway gateway, String tag);

    List<Device> findAlarmDevices(Project project);

    Optional<Device> findByEquipmentAndDescriptionLike(Equipment equipment, String name);

    void saveOrUpdate(Device device, Enterprise enterprise, Project project, Gateway gateway, DeviceTemplate template);

    void saveCoordinate(Device device);

    void setCategory(Device device, DeviceCategory category);

    void deleteCategory(Device device);

    void setCategory(Device device, DeviceCategoryCommon category);

    void deleteCommonCategory(Device device);

    void setDevicesByEquipment(Equipment equipment, String[] deviceIds);

    Device findByEquipmentAndDescription(Equipment equipment, String description);

    List<Device> findByEquipmentInAndDescriptionLike(List<Equipment> energyEquipments, String desc);
}

